package org.mybatis.generator;

import java.io.InputStream;
import java.util.ArrayList;

import org.mybatis.generator.api.MyBatisGenerator;
import org.mybatis.generator.config.Configuration;
import org.mybatis.generator.config.xml.ConfigurationParser;
import org.mybatis.generator.internal.DefaultShellCallback;

public class StartUp
{
    public void genJavaCode()
    {
        
    }
    
    public static void main(String[] args)
    {
        try {
            System.out.println("---------------------------------start");
            ArrayList<String> warnings = new ArrayList<>();
            boolean overwrite = true;
            ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
            InputStream is = classLoader.getResourceAsStream("generatorConfig.xml");
            ConfigurationParser cp = new ConfigurationParser(warnings);
            Configuration config = cp.parseConfiguration(is);
            DefaultShellCallback callback = new DefaultShellCallback(overwrite);
            MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings);
            myBatisGenerator.generate(null);
            System.out.println("---------------------------------end");
        }
        catch (Exception e) {
            e.printStackTrace();
        }
    }
}
